using MOKA.TPM.Utility.Const;
using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace MOKA.TPM.Entity;

/// <summary>
/// 入库主表
/// </summary>
[Tenant(TPMConst.TPMConfigId)]
[SugarTable("PartInM", "入库主表")]
public class PartInM
{
    /// <summary>
    /// 
    /// </summary>
    [SugarColumn(ColumnName = "Id", ColumnDescription = "", IsPrimaryKey = true)]
    public Guid Id { get; set; }

    /// <summary>
    /// 入库单号
    /// </summary>
    [SugarColumn(ColumnName = "BillNo", ColumnDescription = "入库单号", Length = 50)]
    [Required, MaxLength(50)]
    public string BillNo { get; set; } = string.Empty;

    /// <summary>
    /// 入库类型
    /// </summary>
    [SugarColumn(ColumnName = "InType", ColumnDescription = "入库类型")]
    public Guid InType { get; set; }

    /// <summary>
    /// 入库状态
    /// </summary>
    [SugarColumn(ColumnName = "InStatus", ColumnDescription = "入库状态")]
    public Guid InStatus { get; set; }

    /// <summary>
    /// 入库车间
    /// </summary>
    [SugarColumn(ColumnName = "Workshop", ColumnDescription = "入库车间")]
    public Guid Workshop { get; set; }

    /// <summary>
    /// 入库时间
    /// </summary>
    [SugarColumn(ColumnName = "InTime", ColumnDescription = "入库时间")]
    public DateTime InTime { get; set; }

    /// <summary>
    /// SAP申领单号
    /// </summary>
    [SugarColumn(ColumnName = "RequestNo", ColumnDescription = "SAP申领单号", Length = 50)]
    [MaxLength(50)]
    public string? RequestNo { get; set; }

    /// <summary>
    /// SAP申领单行号
    /// </summary>
    [SugarColumn(ColumnName = "RequestItemNo", ColumnDescription = "SAP申领单行号")]
    public int? RequestItemNo { get; set; }

    /// <summary>
    /// SAP申请数量
    /// </summary>
    [SugarColumn(ColumnName = "RequestQty", ColumnDescription = "SAP申请数量")]
    public decimal? RequestQty { get; set; }

    /// <summary>
    /// 确认人
    /// </summary>
    [SugarColumn(ColumnName = "ConMan", ColumnDescription = "确认人", Length = 50)]
    [MaxLength(50)]
    public string? ConMan { get; set; }

    /// <summary>
    /// 确认人姓名
    /// </summary>
    [SugarColumn(ColumnName = "ConManName", ColumnDescription = "确认人姓名", Length = 50)]
    [MaxLength(50)]
    public string? ConManName { get; set; }

    /// <summary>
    /// 确认时间
    /// </summary>
    [SugarColumn(ColumnName = "ConTime", ColumnDescription = "确认时间")]
    public DateTime? ConTime { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 200)]
    [MaxLength(200)]
    public string? Remark { get; set; }

    /// <summary>
    /// SAP凭证号
    /// </summary>
    [SugarColumn(ColumnName = "SapVoucher", ColumnDescription = "SAP凭证号", Length = 50)]
    [MaxLength(50)]
    public string? SapVoucher { get; set; }

    /// <summary>
    /// SAP凭证行号
    /// </summary>
    [SugarColumn(ColumnName = "SapVoucherItemNo", ColumnDescription = "SAP凭证行号")]
    public int? SapVoucherItemNo { get; set; }

    /// <summary>
    /// SAP创建时间
    /// </summary>
    [SugarColumn(ColumnName = "CreateTimeInSAP", ColumnDescription = "SAP创建时间")]
    public DateTime? CreateTimeInSAP { get; set; }

    /// <summary>
    /// SAP更新时间
    /// </summary>
    [SugarColumn(ColumnName = "UpdateTimeInSAP", ColumnDescription = "SAP更新时间")]
    public DateTime? UpdateTimeInSAP { get; set; }

    /// <summary>
    /// SAP同步时间
    /// </summary>
    [SugarColumn(ColumnName = "SyncTime", ColumnDescription = "SAP同步时间")]
    public DateTime? SyncTime { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    [SugarColumn(ColumnName = "CreateUser", ColumnDescription = "创建人", Length = 20)]
    [Required, MaxLength(20)]
    public string CreateUser { get; set; } = string.Empty;

    /// <summary>
    /// 创建时间
    /// </summary>
    [SugarColumn(ColumnName = "CreateTime", ColumnDescription = "创建时间")]
    public DateTime CreateTime { get; set; }

    /// <summary>
    /// 修改人
    /// </summary>
    [SugarColumn(ColumnName = "UpdateUser", ColumnDescription = "修改人", Length = 20)]
    [MaxLength(20)]
    public string? UpdateUser { get; set; }

    /// <summary>
    /// 修改时间
    /// </summary>
    [SugarColumn(ColumnName = "UpdateTime", ColumnDescription = "修改时间")]
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// InStatus (入库状态) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(InStatus),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_InStatus { get; set; }

    /// <summary>
    /// InType (入库类型) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(InType),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_InType { get; set; }

    /// <summary>
    /// Workshop (入库车间) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(Workshop),nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_Workshop { get; set; }

    /// <summary>
    /// CreateUser (创建人) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(CreateUser),nameof(T_USER.UserName))]//多对一
    public T_USER t__USER_CreateUser { get; set; }

    /// <summary>
    /// UpdateUser (修改人) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(UpdateUser),nameof(T_USER.UserName))]//多对一
    public T_USER t__USER_UpdateUser { get; set; }
}